package org.dreamwork.cai.core;

import org.dreamwork.cai.annotation.ARemoteService;
import org.dreamwork.injection.ClassScanner;

import java.util.HashSet;
import java.util.Set;

public class RemoteServiceScanner extends ClassScanner {
//    private final Set<Wrapper> wrappers = new HashSet<> ();
    private final Set<Class<?>> types = new HashSet<> ();

    @Override
    protected boolean accept (Class<?> type) {
        boolean acceptable = type.isAnnotationPresent (ARemoteService.class);
        if (acceptable) {
            types.add (type);
        }
        return acceptable;
    }

    @Override
    protected void onFound (String name, Class<?> type, Set<Wrapper> wrappers) {
        // do nothing
/*
        Wrapper w = new Wrapper ();
        w.type = type;
        wrappers.add (w);
*/
    }

    @Override
    protected void onCompleted (Set<Wrapper> wrappers) {
//        this.wrappers.addAll (wrappers);
        // do nothing
    }

    public Set<Class<?>> getRemoteServiceClasses () {
        return types;
    }
}